package com.ruoyi.pm.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pm.domain.ExcPortHeader;
import com.ruoyi.pm.service.IExcPortHeaderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 接口HeaderController
 * 
 * @author ruoyi
 * @date 2024-08-16
 */
@RestController
@RequestMapping("/pm/excPortHeader")
public class ExcPortHeaderController extends BaseController
{
    @Autowired
    private IExcPortHeaderService excPortHeaderService;

    /**
     * 查询接口Header列表
     */
    @PreAuthorize("@ss.hasPermi('pm:excPortHeader:list')")
    @GetMapping("/list")
    public TableDataInfo list(ExcPortHeader excPortHeader)
    {
        startPage();
        List<ExcPortHeader> list = excPortHeaderService.selectExcPortHeaderList(excPortHeader);
        return getDataTable(list);
    }

    /**
     * 导出接口Header列表
     */
    @PreAuthorize("@ss.hasPermi('pm:excPortHeader:export')")
    @Log(title = "接口Header", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ExcPortHeader excPortHeader)
    {
        List<ExcPortHeader> list = excPortHeaderService.selectExcPortHeaderList(excPortHeader);
        ExcelUtil<ExcPortHeader> util = new ExcelUtil<ExcPortHeader>(ExcPortHeader.class);
        util.exportExcel(response, list, "接口Header数据");
    }

    /**
     * 获取接口Header详细信息
     */
    @PreAuthorize("@ss.hasPermi('pm:excPortHeader:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(excPortHeaderService.selectExcPortHeaderById(id));
    }

    /**
     * 新增接口Header
     */
    @PreAuthorize("@ss.hasPermi('pm:excPortHeader:add')")
    @Log(title = "接口Header", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ExcPortHeader excPortHeader)
    {
        return toAjax(excPortHeaderService.insertExcPortHeader(excPortHeader));
    }

    /**
     * 修改接口Header
     */
    @PreAuthorize("@ss.hasPermi('pm:excPortHeader:edit')")
    @Log(title = "接口Header", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ExcPortHeader excPortHeader)
    {
        return toAjax(excPortHeaderService.updateExcPortHeader(excPortHeader));
    }

    /**
     * 删除接口Header
     */
    @PreAuthorize("@ss.hasPermi('pm:excPortHeader:remove')")
    @Log(title = "接口Header", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(excPortHeaderService.deleteExcPortHeaderByIds(ids));
    }
}
